<?php
namespace Tbf\Bundle\YntAuthBundle\Service;
use Tbf\Bundle\YntAuthBundle\Model\LoginRequest;

class YntAuth {
    /** @var \Tbf\Bundle\YntAuthBundle\Service\MediaManager  */
    protected $media_manager;
    function __construct(
        MediaManager $media_manager
        ){
        $this->media_manager = $media_manager;
    }

    /**
     * @param string $media_en
     * @param LoginRequest $login_request
     * @return \Symfony\Component\HttpFoundation\Response
     */
    function login($media_en,LoginRequest $login_request){
        $media = $this->media_manager->getMediaByMediaNameEn($media_en);
        $login_request->setMedia($media);
        $imp = $this->media_manager->getMediaImpByMediaNameEn($media_en);
        return $imp->login($login_request);
    }

    /**
     * @return \Tbf\Bundle\YntAuthBundle\Service\MediaManager
     */
    public function getMediaManager()
    {
        return $this->media_manager;
    }

}